#!/bin/bash
# IBM_PROLOG_BEGIN_TAG 
# This is an automatically generated prolog. 
#  
#  
#  
# Licensed Materials - Property of IBM 
#  
# Restricted Materials of IBM 
#  
# (C) COPYRIGHT International Business Machines Corp. 2003,2004 
# All Rights Reserved 
#  
# US Government Users Restricted Rights - Use, duplication or 
# disclosure restricted by GSA ADP Schedule Contract with IBM Corp. 
#  
# IBM_PROLOG_END_TAG 

# Start the fnmd limit core files to 1,000,000 KB (1GB max!)
# count is in blocks
ulimit -c 1000000

# set the library paths for libACE.so vpd.lib devDB.lib
unset LD_ASSUME_KERNEL
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/hsc/lib
# 
# The variable below changes the number of logs saved.  
# Activating the line with a postive number (ex 5) will
# save *.log.1 through *.log.5 where *.log.5 is the oldest log.
# This applies to all component logs in /var/hsc/log. 
# export FNM_LOG_SAVE_COUNT=5

# sleep 1 min to allow hwdr_svr vports to stablize
sleep 60

# start and get the main thread's PID work
if [ -f /var/hsc/log/.DEBUG_HSC ]; then
   /opt/hsc/bin/fnmd > /var/hsc/log/fnmd.log 2>&1 &
   TOP_FNMD_ID=$!
else
   /opt/hsc/bin/fnmd &
   TOP_FNMD_ID=$!
fi

# Record the thread's PID for the started fnmd
# this is Linux specific 7.2 will record all threads currently running
sleep 10
ps -ef | grep fnmd | grep opt | awk {'print $2'} > /var/hsc/fnmd_proc_ids

# wait for the main thread to exit
wait $TOP_FNMD_ID
echo "fnmd stopped on "`date` > /tmp/fnmdStopped.log

# run snap tool to capture data after exit
/opt/hsc/bin/fnm.snap
